.class Lcom/peptalk/client/lbs/android/AESEncrypt;
.super Ljava/lang/Object;
.source "AESEncrypt.java"


# direct methods
.method constructor <init>()V
    .locals 0

    .prologue
    .line 12
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method static byte2HexString([B)Ljava/lang/String;
    .locals 6
    .parameter "enbyte"

    .prologue
    .line 35
    array-length v0, p0

    .line 36
    .local v0, enbyteLength:I
    new-instance v1, Ljava/lang/StringBuffer;

    invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V

    .line 38
    .local v1, encryptDatabuffer:Ljava/lang/StringBuffer;
    const/4 v2, 0x0

    .local v2, i:I
    :goto_0
    if-lt v2, v0, :cond_0

    .line 45
    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v4

    return-object v4

    .line 39
    :cond_0
    aget-byte v4, p0, v2

    and-int/lit16 v4, v4, 0xff

    invoke-static {v4}, Ljava/lang/Integer;->toHexString(I)Ljava/lang/String;

    move-result-object v3

    .line 40
    .local v3, temp:Ljava/lang/String;
    invoke-virtual {v3}, Ljava/lang/String;->length()I

    move-result v4

    const/4 v5, 0x2

    if-ge v4, v5, :cond_1

    .line 41
    const-string v4, "0"

    invoke-virtual {v1, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 43
    :cond_1
    invoke-virtual {v1, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 38
    add-int/lit8 v2, v2, 0x1

    goto :goto_0
.end method

.method static encrypt([BLjava/lang/String;)[B
    .locals 7
    .parameter "byteContent"
    .parameter "password"

    .prologue
    const/4 v6, 0x0

    .line 16
    :try_start_0
    new-instance v2, Ljavax/crypto/spec/SecretKeySpec;

    invoke-virtual {p1}, Ljava/lang/String;->getBytes()[B

    move-result-object v4

    const-string v5, "AES"

    invoke-direct {v2, v4, v5}, Ljavax/crypto/spec/SecretKeySpec;-><init>([BLjava/lang/String;)V

    .line 17
    .local v2, key:Ljavax/crypto/spec/SecretKeySpec;
    const-string v4, "AES/ECB/NoPadding"

    invoke-static {v4}, Ljavax/crypto/Cipher;->getInstance(Ljava/lang/String;)Ljavax/crypto/Cipher;

    move-result-object v0

    .line 18
    .local v0, cipher:Ljavax/crypto/Cipher;
    const/4 v4, 0x1

    invoke-virtual {v0, v4, v2}, Ljavax/crypto/Cipher;->init(ILjava/security/Key;)V

    .line 19
    invoke-virtual {v0, p0}, Ljavax/crypto/Cipher;->doFinal([B)[B
    :try_end_0
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljavax/crypto/NoSuchPaddingException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/security/InvalidKeyException; {:try_start_0 .. :try_end_0} :catch_2
    .catch Ljavax/crypto/IllegalBlockSizeException; {:try_start_0 .. :try_end_0} :catch_3
    .catch Ljavax/crypto/BadPaddingException; {:try_start_0 .. :try_end_0} :catch_4

    move-result-object v3

    .local v3, result:[B
    move-object v4, v3

    .line 30
    .end local v0           #cipher:Ljavax/crypto/Cipher;
    .end local v2           #key:Ljavax/crypto/spec/SecretKeySpec;
    .end local v3           #result:[B
    :goto_0
    return-object v4

    .line 21
    :catch_0
    move-exception v4

    move-object v1, v4

    .local v1, e:Ljava/security/NoSuchAlgorithmException;
    move-object v4, v6

    .line 22
    goto :goto_0

    .line 23
    .end local v1           #e:Ljava/security/NoSuchAlgorithmException;
    :catch_1
    move-exception v4

    move-object v1, v4

    .local v1, e:Ljavax/crypto/NoSuchPaddingException;
    move-object v4, v6

    .line 24
    goto :goto_0

    .line 25
    .end local v1           #e:Ljavax/crypto/NoSuchPaddingException;
    :catch_2
    move-exception v4

    move-object v1, v4

    .local v1, e:Ljava/security/InvalidKeyException;
    move-object v4, v6

    .line 26
    goto :goto_0

    .line 27
    .end local v1           #e:Ljava/security/InvalidKeyException;
    :catch_3
    move-exception v4

    move-object v1, v4

    .local v1, e:Ljavax/crypto/IllegalBlockSizeException;
    move-object v4, v6

    .line 28
    goto :goto_0

    .line 29
    .end local v1           #e:Ljavax/crypto/IllegalBlockSizeException;
    :catch_4
    move-exception v4

    move-object v1, v4

    .local v1, e:Ljavax/crypto/BadPaddingException;
    move-object v4, v6

    .line 30
    goto :goto_0
.end method
